<template>
  <router-view />
</template>

<script setup>
import { webUpdater } from '@/units/webUpdater.js'
import { DialogModel } from '@/components'


// 代码更新通知更新
const up = new webUpdater()
let hasDialogModel = false
up.on('update', () => {
  if (!sessionStorage.getItem('NEEDUPDTE') && !hasDialogModel) {
    hasDialogModel = true
    DialogModel({
      title: '提示',
      confirmTitle: '刷新',
      message: '系统已更新,需要刷新页面重新加载数据',
      clickModal: false,
      confirm: () => {
        hasDialogModel = false
        location.reload()
      },
      cancel: () => {
        hasDialogModel = false
        sessionStorage.setItem('NEEDUPDTE', true)
      },
    })
  }
})
</script>

<style scoped></style>
<style>
#app {
  line-height: inherit;
}
</style>
